import request from "../utils/request";

// 登录
export const loginApi = (body) =>{
    return request("/login",{
        method:"post",
        body
    })
}

// 获取用户信息
export const getUserApi = ()=>{
    return request("/user/mrbird",{
        method:'get'
    })
}

// 获取菜单
export const getMenusApi = ()=>{
    return request("/menu/mrbird",{
        method:"get"
    })
}

// 获取浏览量
export const getVisitApi = () =>{
    return request("/index/mrbird",{
        method:'get'
    })
}

// 修改头像
export const changeAvatarApi = (body)=>{
    return  request('user/avatar',{
        body,
        method:"put",
    })
} 

// 编辑资料
export const updateInfoApi = (body)=>{
    return request("/user/profile",{
        method:'put',
        body
    })
}

// 获取用户列表
export const getUserListApi = (query)=>{
    return request("/user",{
        method:'get',
        query
    })
}

//新增用户
export const addUserApi=(body)=>{
    return request('/user',{
        method:'post',
        body,
    })
}

//修改用户信息
export const updateUserApi=(body)=>{
    return request('/user',{
        method:'put',
        body,
    })
}

// 删除user/${userId}
export const  delUserApi=(userId)=>request(`user/${userId}`,{
    method:'delete',
})

// 获取角色数据
export const  getRoleApi=()=>request('role',{
    method:'get',
})
// 获取部门数据
export const  getDeptApi=(body)=>request(`dept`,{
    method:'get',
})